﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="销售产值.aspx.cs" Inherits="syc.Produce.销售产值" %>
<html>
<head>
    <style type="text/css">
        .style1
        {
            width: 399px;
        }
    </style>
</head>
<body>

<script type="text/javascript" language="javascript" src="/common.js"></script>

    <form id="form1" runat="server">
        <div id="wintop" class="wintop">销售产值</div>
        <asp:Panel ID="Panel1" runat="server" CssClass="panel">
        <input type="button" value="录 入" class="button" onclick="parent.swin2_load('/Produce/销售产值_IN.aspx',490,200);"/>
            <asp:Panel ID="Panel3" runat="server" CssClass="panel" GroupingText="查 询">
                年 度：<asp:DropDownList ID="NianDu" runat="server" AutoPostBack="true" 
                    Width="120px" onselectedindexchanged="Button_Query_Click">                    
                    <asp:ListItem>2009</asp:ListItem>
                    <asp:ListItem>2010</asp:ListItem>
                    <asp:ListItem>2011</asp:ListItem>
                    <asp:ListItem>2012</asp:ListItem>
                    <asp:ListItem>2013</asp:ListItem>
                    <asp:ListItem>2014</asp:ListItem>
                    <asp:ListItem>2015</asp:ListItem>
                </asp:DropDownList>
               月份：<asp:DropDownList ID="YueFen" runat="server">      
                    <asp:ListItem Value=0>年度</asp:ListItem>              
                    <asp:ListItem>1</asp:ListItem>              
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                    <asp:ListItem>5</asp:ListItem>
                    <asp:ListItem>6</asp:ListItem>
                    <asp:ListItem>7</asp:ListItem>
                    <asp:ListItem>8</asp:ListItem>
                    <asp:ListItem>9</asp:ListItem>
                    <asp:ListItem>10</asp:ListItem>
                    <asp:ListItem>11</asp:ListItem>
                    <asp:ListItem>12</asp:ListItem>                  
                </asp:DropDownList> 
                产 品：<asp:DropDownList ID="DL_ChanPin" runat="server">
                    <asp:ListItem Value="0">全部</asp:ListItem>                    
                    <asp:ListItem Value="1">油管</asp:ListItem>
                    <asp:ListItem Value="2">套管</asp:ListItem>
                    <asp:ListItem Value="3">带钢</asp:ListItem>
                </asp:DropDownList>
                <asp:Button ID="Button_Query" runat="server" CssClass="button" 
                    OnClick="Button_Query_Click" Text="查 询" UseSubmitBehavior="False" />
            </asp:Panel>
        </asp:Panel>
    
    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
	            <tr>
		            <td class="grid-title">销售产值</td>
		        </tr>
		        <tr>
		            <td class="grid-back">
                        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                            
                            SelectCommand="SELECT [ID], 
                                                 CASE 
                                                    WHEN [产品类型ID]=1 THEN '油管'
                                                    WHEN [产品类型ID]=2 THEN '套管'
                                                    WHEN [产品类型ID]=3 THEN '带钢'
                                                 END AS 产品类型ID, 
                                                 [年份], [月份], [计划销售产值],
                                                  [实际销售产值] 
                                           FROM [销售产值数据]
                                           WHERE [年份]=@年份
                                                 AND (产品类型ID=@产品 OR 0=@产品) and [月份]=@月份                                            
                                           ORDER BY [年份], [月份]" 
                            DeleteCommand="DELETE FROM [销售产值数据] WHERE [ID] = @ID" 
                            InsertCommand="INSERT INTO [销售产值数据] ([产品类型ID], [年份], [月份], [计划销售产值], [实际销售产值]) VALUES (@产品类型ID, @年份, @月份, @计划销售产值, @实际销售产值)" 
                            
                            UpdateCommand="UPDATE [销售产值数据] 
                                            SET [计划销售产值] = @计划销售产值, [实际销售产值] = @实际销售产值 
                                            WHERE [ID] = @ID">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="NianDu" PropertyName="SelectedValue" Type="Int32" Name="年份" />
                                <asp:ControlParameter ControlID="YueFen" PropertyName="SelectedValue" Type="Int32" Name="月份" />
                                <asp:ControlParameter ControlID="DL_ChanPin" PropertyName="SelectedValue" Type="Int32" Name="产品" />                                
                            </SelectParameters>                
                            <DeleteParameters>
                                <asp:Parameter Name="ID" Type="Int32" />
                            </DeleteParameters>
                            <UpdateParameters>
                                <asp:Parameter Name="计划销售产值" Type="Decimal" />
                                <asp:Parameter Name="实际销售产值" Type="Decimal" />
                                <asp:Parameter Name="ID" Type="Int32" />
                            </UpdateParameters>
                            <InsertParameters>
                                <asp:Parameter Name="产品类型ID" Type="Int32" />
                                <asp:Parameter Name="年份" Type="Int32" />
                                <asp:Parameter Name="月份" Type="Int32" />
                                <asp:Parameter Name="计划销售产值" Type="Decimal" />
                                <asp:Parameter Name="实际销售产值" Type="Decimal" />
                            </InsertParameters>
                        </asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                            AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID" 
                            DataSourceID="SqlDataSource2" 
                            GridLines="None" ondatabound="GridView1_DataBound" 
                            onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                            UseAccessibleHeader="False">
                            <PagerSettings Visible="False" />
                            <RowStyle CssClass="grid-row-normal" />
                            <Columns>
                             
                                <asp:TemplateField HeaderText="产品类型" SortExpression="产品类型ID">
                                    <ItemTemplate>
                                    <asp:Label ID="cp" runat="server" Text='<%# Eval("产品类型ID") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />                                     
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="年份" SortExpression="年份">
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("年份") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />                                     
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="月份" SortExpression="月份">
                                    <ItemTemplate>
                                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("月份") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />                                     
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="计划销售产值" SortExpression="计划销售产值">
                                    <ItemTemplate>
                                        <asp:Label ID="Label5" runat="server" Text='<%# String.Format("{0:C}",Eval("计划销售产值")) %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("计划销售产值") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="200px" />                                     
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="实际销售产值" SortExpression="实际销售产值">
                                    <ItemTemplate>
                                        <asp:Label ID="Label6" runat="server" Text='<%# String.Format("{0:C}",Eval("实际销售产值")) %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("实际销售产值") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="200px" />                                     
                                </asp:TemplateField>  
                                <asp:TemplateField ShowHeader="False">
                                    <ItemTemplate>
                                        <asp:Button ID="Button1" runat="server" CausesValidation="False" 
                                            CommandName="Edit" Text="编辑" CssClass="smallbutton"/>
                                        &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" 
                                            CommandName="Delete" Text="删除" CssClass="smallbutton" />
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:Button ID="Button1" runat="server" CausesValidation="True" 
                                            CommandName="Update" Text="更新" CssClass="smallbutton"/>
                                        &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" 
                                            CommandName="Cancel" Text="取消" CssClass="smallbutton"/>
                                    </EditItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                          </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>
		                <table width="100%">
		                    <tr>
		                        <td class="pagebar">
                                    <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                        CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                    <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                        CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                    <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                        ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server"></asp:Label><input type="button" class="page-split" />
                                    
                                    <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                        CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                    <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                        CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                                </td>
                                <td align="right">
                                    <asp:Label ID="Label_Total" runat="server" CssClass="grid_totalrows"></asp:Label>
                                </td>
                            </tr>
                       </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
    
    </form>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
        }
    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }
</script>
</body>
</html>
